package com.jsu.forum.controller.v1;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.jsu.forum.service.impl.LikeServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.model.common.dtos.ResponseResult;
import org.example.model.forum.dto.LikeDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/web/v1/like")
@Api(tags = "点赞控制器")
public class LikeController {
    @Autowired
    private LikeServiceImpl likeService;
    private static final ObjectMapper mapper = new ObjectMapper();

    @ApiOperation(value = "点赞/取消点赞")
    @PostMapping("/click")
    public ResponseResult clickLike(@RequestBody LikeDto like){
        return likeService.clickLike(like);
    }
}
